/*
 * Copyright (c) 2023 iQi.Co.Ltd. All rights reserved.
 */
 
using System.Collections.Generic;
using NetProtocol.POD;
using NetProtocol.Enum;
using IQIGame.Onigao.Game;
using IQIGame.Onigao.GamePlay;
using IQIGame.Onigao.Framework;
using Cysharp.Threading.Tasks;
using System;
using static IQIGame.Onigao.Game.MessageWrapper;

namespace NetProtocol.Client {
	/// <summary>
	/// 英雄
	/// module : hero
	/// </summary>
	public interface CNetHero : INetClientModule {
		
		public ISession GetSession();
	
		Dictionary<int, INetClientModule.Package2MessageWrapper> INetClientModule.GetModuleFunction()
        {
            MessageFunction upLevelResult_Delegate = (session, wrapper) =>
            {
            	var _wrapper = (MessageWrapper<UpLevelResultData>)wrapper;
                SC_upLevelResult(session, ref _wrapper.message);
                MessageWrapperPool<UpLevelResultData>.Put(_wrapper);
            };
            MessageFunction awakenResult_Delegate = (session, wrapper) =>
            {
            	var _wrapper = (MessageWrapper<AwakenResultData>)wrapper;
                SC_awakenResult(session, ref _wrapper.message);
                MessageWrapperPool<AwakenResultData>.Put(_wrapper);
            };
            MessageFunction upStarResult_Delegate = (session, wrapper) =>
            {
            	var _wrapper = (MessageWrapper<UpStarResultData>)wrapper;
                SC_upStarResult(session, ref _wrapper.message);
                MessageWrapperPool<UpStarResultData>.Put(_wrapper);
            };
            MessageFunction upSkillResult_Delegate = (session, wrapper) =>
            {
            	var _wrapper = (MessageWrapper<UpSkillResultData>)wrapper;
                SC_upSkillResult(session, ref _wrapper.message);
                MessageWrapperPool<UpSkillResultData>.Put(_wrapper);
            };
            MessageFunction upFateTrajectoryResult_Delegate = (session, wrapper) =>
            {
            	var _wrapper = (MessageWrapper<UpFateTrajectoryResultData>)wrapper;
                SC_upFateTrajectoryResult(session, ref _wrapper.message);
                MessageWrapperPool<UpFateTrajectoryResultData>.Put(_wrapper);
            };
            MessageFunction wearEquipResult_Delegate = (session, wrapper) =>
            {
            	var _wrapper = (MessageWrapper<WearEquipResultData>)wrapper;
                SC_wearEquipResult(session, ref _wrapper.message);
                MessageWrapperPool<WearEquipResultData>.Put(_wrapper);
            };
            MessageFunction wearPetResult_Delegate = (session, wrapper) =>
            {
            	var _wrapper = (MessageWrapper<WearPetResultData>)wrapper;
                SC_wearPetResult(session, ref _wrapper.message);
                MessageWrapperPool<WearPetResultData>.Put(_wrapper);
            };
            MessageFunction clearEquipResult_Delegate = (session, wrapper) =>
            {
            	var _wrapper = (MessageWrapper<ClearEquipResultData>)wrapper;
                SC_clearEquipResult(session, ref _wrapper.message);
                MessageWrapperPool<ClearEquipResultData>.Put(_wrapper);
            };
            MessageFunction notifyHeroActive_Delegate = (session, wrapper) =>
            {
            var _wrapper = (MessageWrapper<NotifyHeroActiveData>)wrapper; 
#if ENABLE_NET_LOG || UNITY_EDITOR
            NetProtocolHelper.ClientLog(NetMessageId.hero_notifyHeroActive, "Recv->" + _wrapper.message.ToString());
#endif
                SC_notifyHeroActive(session, _wrapper.message.heroPOD);
                MessageWrapperPool<NotifyHeroActiveData>.Put(_wrapper);
            };
            MessageFunction notifyHeroAttrs_Delegate = (session, wrapper) =>
            {
            var _wrapper = (MessageWrapper<NotifyHeroAttrsData>)wrapper; 
#if ENABLE_NET_LOG || UNITY_EDITOR
            NetProtocolHelper.ClientLog(NetMessageId.hero_notifyHeroAttrs, "Recv->" + _wrapper.message.ToString());
#endif
                SC_notifyHeroAttrs(session, _wrapper.message.heroPOD);
                MessageWrapperPool<NotifyHeroAttrsData>.Put(_wrapper);
            };
        
            Dictionary<int, INetClientModule.Package2MessageWrapper> retDic = new()
            {
                {NetMessageId.hero_upLevelResult, (session, package) => {
                	var result = MessageWrapperPool<UpLevelResultData>.Get();
                	result.Init(session, upLevelResult_Delegate);
                	result.FromPackage(package);
                	return result;
                }},
                {NetMessageId.hero_awakenResult, (session, package) => {
                	var result = MessageWrapperPool<AwakenResultData>.Get();
                	result.Init(session, awakenResult_Delegate);
                	result.FromPackage(package);
                	return result;
                }},
                {NetMessageId.hero_upStarResult, (session, package) => {
                	var result = MessageWrapperPool<UpStarResultData>.Get();
                	result.Init(session, upStarResult_Delegate);
                	result.FromPackage(package);
                	return result;
                }},
                {NetMessageId.hero_upSkillResult, (session, package) => {
                	var result = MessageWrapperPool<UpSkillResultData>.Get();
                	result.Init(session, upSkillResult_Delegate);
                	result.FromPackage(package);
                	return result;
                }},
                {NetMessageId.hero_upFateTrajectoryResult, (session, package) => {
                	var result = MessageWrapperPool<UpFateTrajectoryResultData>.Get();
                	result.Init(session, upFateTrajectoryResult_Delegate);
                	result.FromPackage(package);
                	return result;
                }},
                {NetMessageId.hero_wearEquipResult, (session, package) => {
                	var result = MessageWrapperPool<WearEquipResultData>.Get();
                	result.Init(session, wearEquipResult_Delegate);
                	result.FromPackage(package);
                	return result;
                }},
                {NetMessageId.hero_wearPetResult, (session, package) => {
                	var result = MessageWrapperPool<WearPetResultData>.Get();
                	result.Init(session, wearPetResult_Delegate);
                	result.FromPackage(package);
                	return result;
                }},
                {NetMessageId.hero_clearEquipResult, (session, package) => {
                	var result = MessageWrapperPool<ClearEquipResultData>.Get();
                	result.Init(session, clearEquipResult_Delegate);
                	result.FromPackage(package);
                	return result;
                }},
                {NetMessageId.hero_notifyHeroActive, (session, package) => {
                	var result = MessageWrapperPool<NotifyHeroActiveData>.Get();
                	result.Init(session, notifyHeroActive_Delegate);
                	result.FromPackage(package);
                	return result;
                }},
                {NetMessageId.hero_notifyHeroAttrs, (session, package) => {
                	var result = MessageWrapperPool<NotifyHeroAttrsData>.Get();
                	result.Init(session, notifyHeroAttrs_Delegate);
                	result.FromPackage(package);
                	return result;
                }},
            };
            return retDic;
        }
#region Client-side Interface
		/// <summary>
        ///  升级结果，成功时替换
        /// </summary>
		public void SC_upLevelResult(ISession session, ref UpLevelResultData message) 
		{
            _SC_upLevelResult(session, ref message);
		}
		
		public void _SC_upLevelResult(ISession session, ref UpLevelResultData message)
		{
#if ENABLE_NET_LOG || UNITY_EDITOR
            NetProtocolHelper.ClientLog(NetMessageId.hero_upLevelResult, "Recv->" + message.ToString());
#endif
			NetProtocolHelper.endCallRequest?.Invoke(NetMessageId.hero_upLevelResult, message.code);
			MsgAsyncAwaiter<UpLevelResultData>.Instance.CompleteMsgAwait(ref message);
		}
		
		/// <summary>
        ///  觉醒结构，成功时替换
        /// </summary>
		public void SC_awakenResult(ISession session, ref AwakenResultData message) 
		{
            _SC_awakenResult(session, ref message);
		}
		
		public void _SC_awakenResult(ISession session, ref AwakenResultData message)
		{
#if ENABLE_NET_LOG || UNITY_EDITOR
            NetProtocolHelper.ClientLog(NetMessageId.hero_awakenResult, "Recv->" + message.ToString());
#endif
			NetProtocolHelper.endCallRequest?.Invoke(NetMessageId.hero_awakenResult, message.code);
			MsgAsyncAwaiter<AwakenResultData>.Instance.CompleteMsgAwait(ref message);
		}
		
		/// <summary>
        ///  升星结果，成功时替换
        /// </summary>
		public void SC_upStarResult(ISession session, ref UpStarResultData message) 
		{
            _SC_upStarResult(session, ref message);
		}
		
		public void _SC_upStarResult(ISession session, ref UpStarResultData message)
		{
#if ENABLE_NET_LOG || UNITY_EDITOR
            NetProtocolHelper.ClientLog(NetMessageId.hero_upStarResult, "Recv->" + message.ToString());
#endif
			NetProtocolHelper.endCallRequest?.Invoke(NetMessageId.hero_upStarResult, message.code);
			MsgAsyncAwaiter<UpStarResultData>.Instance.CompleteMsgAwait(ref message);
		}
		
		/// <summary>
        ///  升级技能结果，成功时加1
        /// </summary>
		public void SC_upSkillResult(ISession session, ref UpSkillResultData message) 
		{
            _SC_upSkillResult(session, ref message);
		}
		
		public void _SC_upSkillResult(ISession session, ref UpSkillResultData message)
		{
#if ENABLE_NET_LOG || UNITY_EDITOR
            NetProtocolHelper.ClientLog(NetMessageId.hero_upSkillResult, "Recv->" + message.ToString());
#endif
			NetProtocolHelper.endCallRequest?.Invoke(NetMessageId.hero_upSkillResult, message.code);
			MsgAsyncAwaiter<UpSkillResultData>.Instance.CompleteMsgAwait(ref message);
		}
		
		/// <summary>
        ///  升级命轨结果
        /// </summary>
		public void SC_upFateTrajectoryResult(ISession session, ref UpFateTrajectoryResultData message) 
		{
            _SC_upFateTrajectoryResult(session, ref message);
		}
		
		public void _SC_upFateTrajectoryResult(ISession session, ref UpFateTrajectoryResultData message)
		{
#if ENABLE_NET_LOG || UNITY_EDITOR
            NetProtocolHelper.ClientLog(NetMessageId.hero_upFateTrajectoryResult, "Recv->" + message.ToString());
#endif
			NetProtocolHelper.endCallRequest?.Invoke(NetMessageId.hero_upFateTrajectoryResult, message.code);
			MsgAsyncAwaiter<UpFateTrajectoryResultData>.Instance.CompleteMsgAwait(ref message);
		}
		
		/// <summary>
        ///  穿戴装备结果，其它英雄脱装备通过notifyHeroAttrs更新
        /// </summary>
		public void SC_wearEquipResult(ISession session, ref WearEquipResultData message) 
		{
            _SC_wearEquipResult(session, ref message);
		}
		
		public void _SC_wearEquipResult(ISession session, ref WearEquipResultData message)
		{
#if ENABLE_NET_LOG || UNITY_EDITOR
            NetProtocolHelper.ClientLog(NetMessageId.hero_wearEquipResult, "Recv->" + message.ToString());
#endif
			NetProtocolHelper.endCallRequest?.Invoke(NetMessageId.hero_wearEquipResult, message.code);
			MsgAsyncAwaiter<WearEquipResultData>.Instance.CompleteMsgAwait(ref message);
		}
		
		/// <summary>
        /// 穿戴宠物结果，其它英雄脱装备通过notifyHeroAttrs更新
        /// </summary>
		public void SC_wearPetResult(ISession session, ref WearPetResultData message) 
		{
            _SC_wearPetResult(session, ref message);
		}
		
		public void _SC_wearPetResult(ISession session, ref WearPetResultData message)
		{
#if ENABLE_NET_LOG || UNITY_EDITOR
            NetProtocolHelper.ClientLog(NetMessageId.hero_wearPetResult, "Recv->" + message.ToString());
#endif
			NetProtocolHelper.endCallRequest?.Invoke(NetMessageId.hero_wearPetResult, message.code);
			MsgAsyncAwaiter<WearPetResultData>.Instance.CompleteMsgAwait(ref message);
		}
		
		/// <summary>
        ///  脱装备结果
        /// </summary>
		public void SC_clearEquipResult(ISession session, ref ClearEquipResultData message) 
		{
            _SC_clearEquipResult(session, ref message);
		}
		
		public void _SC_clearEquipResult(ISession session, ref ClearEquipResultData message)
		{
#if ENABLE_NET_LOG || UNITY_EDITOR
            NetProtocolHelper.ClientLog(NetMessageId.hero_clearEquipResult, "Recv->" + message.ToString());
#endif
			NetProtocolHelper.endCallRequest?.Invoke(NetMessageId.hero_clearEquipResult, message.code);
			MsgAsyncAwaiter<ClearEquipResultData>.Instance.CompleteMsgAwait(ref message);
		}
		
		/// <summary>
        ///  通知激活了英雄
        /// </summary>
		protected void SC_notifyHeroActive(ISession session, HeroPOD heroPOD);
		/// <summary>
        ///  通知属性变化 -- 正常操作的情况下不通知
        /// </summary>
		protected void SC_notifyHeroAttrs(ISession session, HeroPOD heroPOD);
#endregion
#region Server-side Interface
		/// <summary>
        ///  升级
        /// </summary>
    	public UniTask<UpLevelResultData> CS_upLevel(int heroCid, Dictionary<int, int> items)
        {
            return _CS_upLevel(heroCid, items);
        }
        
        public UniTask<UpLevelResultData> _CS_upLevel(int heroCid, Dictionary<int, int> items)
        {
        	ISession session = GetSession();
        	if(session == null) return UniTask.FromResult(default(UpLevelResultData));
#if ENABLE_NET_LOG || UNITY_EDITOR
			NetProtocolHelper.ClientLog(NetMessageId.hero_upLevel, "Send->"+"Hero.CS_upLevel { "
				+ "heroCid="
				+ heroCid
				+ ", items="
				+ items.ToString<int, int>()
				+" }");
#endif
        	UniTask<UpLevelResultData> task = MsgAsyncAwaiter<UpLevelResultData>.Instance.AddMsgAwait();
        	session.SendPack(Pack_for_upLevel(heroCid, items));
        	NetProtocolHelper.beginCallRequest?.Invoke(NetMessageId.hero_upLevelResult);
			return task;
        }
		
		public static SendPackage Pack_for_upLevel(int heroCid, Dictionary<int, int> items) 
		{
			SendPackage si_p = NetProtocolHelper.GetSendPackage();
			si_p.Header.Messagid = NetMessageId.hero_upLevel;
			si_p.StartWrite();
			SOutputStream _out = si_p.OutputStream;
			_out.Write_int(heroCid);
			_out.Write_map_int_int(items);
			return si_p;
		}
		/// <summary>
        ///  觉醒
        /// </summary>
    	public UniTask<AwakenResultData> CS_awaken(int heroCid)
        {
            return _CS_awaken(heroCid);
        }
        
        public UniTask<AwakenResultData> _CS_awaken(int heroCid)
        {
        	ISession session = GetSession();
        	if(session == null) return UniTask.FromResult(default(AwakenResultData));
#if ENABLE_NET_LOG || UNITY_EDITOR
			NetProtocolHelper.ClientLog(NetMessageId.hero_awaken, "Send->"+"Hero.CS_awaken { "
				+ "heroCid="
				+ heroCid
				+" }");
#endif
        	UniTask<AwakenResultData> task = MsgAsyncAwaiter<AwakenResultData>.Instance.AddMsgAwait();
        	session.SendPack(Pack_for_awaken(heroCid));
        	NetProtocolHelper.beginCallRequest?.Invoke(NetMessageId.hero_awakenResult);
			return task;
        }
		
		public static SendPackage Pack_for_awaken(int heroCid) 
		{
			SendPackage si_p = NetProtocolHelper.GetSendPackage();
			si_p.Header.Messagid = NetMessageId.hero_awaken;
			si_p.StartWrite();
			SOutputStream _out = si_p.OutputStream;
			_out.Write_int(heroCid);
			return si_p;
		}
		/// <summary>
        ///  升星
        /// </summary>
    	public UniTask<UpStarResultData> CS_upStar(int heroCid)
        {
            return _CS_upStar(heroCid);
        }
        
        public UniTask<UpStarResultData> _CS_upStar(int heroCid)
        {
        	ISession session = GetSession();
        	if(session == null) return UniTask.FromResult(default(UpStarResultData));
#if ENABLE_NET_LOG || UNITY_EDITOR
			NetProtocolHelper.ClientLog(NetMessageId.hero_upStar, "Send->"+"Hero.CS_upStar { "
				+ "heroCid="
				+ heroCid
				+" }");
#endif
        	UniTask<UpStarResultData> task = MsgAsyncAwaiter<UpStarResultData>.Instance.AddMsgAwait();
        	session.SendPack(Pack_for_upStar(heroCid));
        	NetProtocolHelper.beginCallRequest?.Invoke(NetMessageId.hero_upStarResult);
			return task;
        }
		
		public static SendPackage Pack_for_upStar(int heroCid) 
		{
			SendPackage si_p = NetProtocolHelper.GetSendPackage();
			si_p.Header.Messagid = NetMessageId.hero_upStar;
			si_p.StartWrite();
			SOutputStream _out = si_p.OutputStream;
			_out.Write_int(heroCid);
			return si_p;
		}
		/// <summary>
        ///  升级技能
        /// </summary>
    	public UniTask<UpSkillResultData> CS_upSkill(int heroCid, int skillCid)
        {
            return _CS_upSkill(heroCid, skillCid);
        }
        
        public UniTask<UpSkillResultData> _CS_upSkill(int heroCid, int skillCid)
        {
        	ISession session = GetSession();
        	if(session == null) return UniTask.FromResult(default(UpSkillResultData));
#if ENABLE_NET_LOG || UNITY_EDITOR
			NetProtocolHelper.ClientLog(NetMessageId.hero_upSkill, "Send->"+"Hero.CS_upSkill { "
				+ "heroCid="
				+ heroCid
				+ ", skillCid="
				+ skillCid
				+" }");
#endif
        	UniTask<UpSkillResultData> task = MsgAsyncAwaiter<UpSkillResultData>.Instance.AddMsgAwait();
        	session.SendPack(Pack_for_upSkill(heroCid, skillCid));
        	NetProtocolHelper.beginCallRequest?.Invoke(NetMessageId.hero_upSkillResult);
			return task;
        }
		
		public static SendPackage Pack_for_upSkill(int heroCid, int skillCid) 
		{
			SendPackage si_p = NetProtocolHelper.GetSendPackage();
			si_p.Header.Messagid = NetMessageId.hero_upSkill;
			si_p.StartWrite();
			SOutputStream _out = si_p.OutputStream;
			_out.Write_int(heroCid);
			_out.Write_int(skillCid);
			return si_p;
		}
		/// <summary>
        ///  升级命轨
        /// </summary>
    	public UniTask<UpFateTrajectoryResultData> CS_upFateTrajectory(int heroCid)
        {
            return _CS_upFateTrajectory(heroCid);
        }
        
        public UniTask<UpFateTrajectoryResultData> _CS_upFateTrajectory(int heroCid)
        {
        	ISession session = GetSession();
        	if(session == null) return UniTask.FromResult(default(UpFateTrajectoryResultData));
#if ENABLE_NET_LOG || UNITY_EDITOR
			NetProtocolHelper.ClientLog(NetMessageId.hero_upFateTrajectory, "Send->"+"Hero.CS_upFateTrajectory { "
				+ "heroCid="
				+ heroCid
				+" }");
#endif
        	UniTask<UpFateTrajectoryResultData> task = MsgAsyncAwaiter<UpFateTrajectoryResultData>.Instance.AddMsgAwait();
        	session.SendPack(Pack_for_upFateTrajectory(heroCid));
        	NetProtocolHelper.beginCallRequest?.Invoke(NetMessageId.hero_upFateTrajectoryResult);
			return task;
        }
		
		public static SendPackage Pack_for_upFateTrajectory(int heroCid) 
		{
			SendPackage si_p = NetProtocolHelper.GetSendPackage();
			si_p.Header.Messagid = NetMessageId.hero_upFateTrajectory;
			si_p.StartWrite();
			SOutputStream _out = si_p.OutputStream;
			_out.Write_int(heroCid);
			return si_p;
		}
		/// <summary>
        ///  穿戴装备，0表示脱下
        /// </summary>
    	public UniTask<WearEquipResultData> CS_wearEquip(int heroCid, int slot, long equipId)
        {
            return _CS_wearEquip(heroCid, slot, equipId);
        }
        
        public UniTask<WearEquipResultData> _CS_wearEquip(int heroCid, int slot, long equipId)
        {
        	ISession session = GetSession();
        	if(session == null) return UniTask.FromResult(default(WearEquipResultData));
#if ENABLE_NET_LOG || UNITY_EDITOR
			NetProtocolHelper.ClientLog(NetMessageId.hero_wearEquip, "Send->"+"Hero.CS_wearEquip { "
				+ "heroCid="
				+ heroCid
				+ ", slot="
				+ slot
				+ ", equipId="
				+ equipId
				+" }");
#endif
        	UniTask<WearEquipResultData> task = MsgAsyncAwaiter<WearEquipResultData>.Instance.AddMsgAwait();
        	session.SendPack(Pack_for_wearEquip(heroCid, slot, equipId));
        	NetProtocolHelper.beginCallRequest?.Invoke(NetMessageId.hero_wearEquipResult);
			return task;
        }
		
		public static SendPackage Pack_for_wearEquip(int heroCid, int slot, long equipId) 
		{
			SendPackage si_p = NetProtocolHelper.GetSendPackage();
			si_p.Header.Messagid = NetMessageId.hero_wearEquip;
			si_p.StartWrite();
			SOutputStream _out = si_p.OutputStream;
			_out.Write_int(heroCid);
			_out.Write_int(slot);
			_out.Write_long(equipId);
			return si_p;
		}
		/// <summary>
        ///  穿戴宠物，0表示脱下
        /// </summary>
    	public UniTask<WearPetResultData> CS_wearPet(int heroCid, long petId)
        {
            return _CS_wearPet(heroCid, petId);
        }
        
        public UniTask<WearPetResultData> _CS_wearPet(int heroCid, long petId)
        {
        	ISession session = GetSession();
        	if(session == null) return UniTask.FromResult(default(WearPetResultData));
#if ENABLE_NET_LOG || UNITY_EDITOR
			NetProtocolHelper.ClientLog(NetMessageId.hero_wearPet, "Send->"+"Hero.CS_wearPet { "
				+ "heroCid="
				+ heroCid
				+ ", petId="
				+ petId
				+" }");
#endif
        	UniTask<WearPetResultData> task = MsgAsyncAwaiter<WearPetResultData>.Instance.AddMsgAwait();
        	session.SendPack(Pack_for_wearPet(heroCid, petId));
        	NetProtocolHelper.beginCallRequest?.Invoke(NetMessageId.hero_wearPetResult);
			return task;
        }
		
		public static SendPackage Pack_for_wearPet(int heroCid, long petId) 
		{
			SendPackage si_p = NetProtocolHelper.GetSendPackage();
			si_p.Header.Messagid = NetMessageId.hero_wearPet;
			si_p.StartWrite();
			SOutputStream _out = si_p.OutputStream;
			_out.Write_int(heroCid);
			_out.Write_long(petId);
			return si_p;
		}
		/// <summary>
        ///  脱下所有装备--含宠物
        /// </summary>
    	public UniTask<ClearEquipResultData> CS_clearEquip(int heroCid)
        {
            return _CS_clearEquip(heroCid);
        }
        
        public UniTask<ClearEquipResultData> _CS_clearEquip(int heroCid)
        {
        	ISession session = GetSession();
        	if(session == null) return UniTask.FromResult(default(ClearEquipResultData));
#if ENABLE_NET_LOG || UNITY_EDITOR
			NetProtocolHelper.ClientLog(NetMessageId.hero_clearEquip, "Send->"+"Hero.CS_clearEquip { "
				+ "heroCid="
				+ heroCid
				+" }");
#endif
        	UniTask<ClearEquipResultData> task = MsgAsyncAwaiter<ClearEquipResultData>.Instance.AddMsgAwait();
        	session.SendPack(Pack_for_clearEquip(heroCid));
        	NetProtocolHelper.beginCallRequest?.Invoke(NetMessageId.hero_clearEquipResult);
			return task;
        }
		
		public static SendPackage Pack_for_clearEquip(int heroCid) 
		{
			SendPackage si_p = NetProtocolHelper.GetSendPackage();
			si_p.Header.Messagid = NetMessageId.hero_clearEquip;
			si_p.StartWrite();
			SOutputStream _out = si_p.OutputStream;
			_out.Write_int(heroCid);
			return si_p;
		}
#endregion
#region Messages
        public struct UpLevelResultData : IReceiveMessage {
        	private int? _code;
        	public int code {get{return _code == null ? -1 : (int)_code;}private set{_code = value;}}
	        public HeroPOD heroPOD;
            public bool IsFail => _code != null && _code != 0;
            public bool IsSuccess =>_code != null && _code == 0;
            public bool IsCanceled => _code == null;
            public void FromPackage(ReceivePackage _package)
            {
                SInputStream _in = _package.InputStream;
                code = _in.HasRemaining() ? _in.Read_int() : default;
                heroPOD = _in.HasRemaining() ? _in.Read_pod<HeroPOD>(HeroPOD.DynamicFactory) : default;
            }
            
            public int GetMessageId() {return NetMessageId.hero_upLevelResult;}
            
            public override string ToString()
            {
                return "Hero.upLevelResult"+ ", code="+ code+ ", heroPOD="+ heroPOD;
            }
        }
        public struct AwakenResultData : IReceiveMessage {
        	private int? _code;
        	public int code {get{return _code == null ? -1 : (int)_code;}private set{_code = value;}}
	        public HeroPOD heroPOD;
            public bool IsFail => _code != null && _code != 0;
            public bool IsSuccess =>_code != null && _code == 0;
            public bool IsCanceled => _code == null;
            public void FromPackage(ReceivePackage _package)
            {
                SInputStream _in = _package.InputStream;
                code = _in.HasRemaining() ? _in.Read_int() : default;
                heroPOD = _in.HasRemaining() ? _in.Read_pod<HeroPOD>(HeroPOD.DynamicFactory) : default;
            }
            
            public int GetMessageId() {return NetMessageId.hero_awakenResult;}
            
            public override string ToString()
            {
                return "Hero.awakenResult"+ ", code="+ code+ ", heroPOD="+ heroPOD;
            }
        }
        public struct UpStarResultData : IReceiveMessage {
        	private int? _code;
        	public int code {get{return _code == null ? -1 : (int)_code;}private set{_code = value;}}
	        public HeroPOD heroPOD;
            public bool IsFail => _code != null && _code != 0;
            public bool IsSuccess =>_code != null && _code == 0;
            public bool IsCanceled => _code == null;
            public void FromPackage(ReceivePackage _package)
            {
                SInputStream _in = _package.InputStream;
                code = _in.HasRemaining() ? _in.Read_int() : default;
                heroPOD = _in.HasRemaining() ? _in.Read_pod<HeroPOD>(HeroPOD.DynamicFactory) : default;
            }
            
            public int GetMessageId() {return NetMessageId.hero_upStarResult;}
            
            public override string ToString()
            {
                return "Hero.upStarResult"+ ", code="+ code+ ", heroPOD="+ heroPOD;
            }
        }
        public struct UpSkillResultData : IReceiveMessage {
        	private int? _code;
        	public int code {get{return _code == null ? -1 : (int)_code;}private set{_code = value;}}
            public bool IsFail => _code != null && _code != 0;
            public bool IsSuccess =>_code != null && _code == 0;
            public bool IsCanceled => _code == null;
            public void FromPackage(ReceivePackage _package)
            {
                SInputStream _in = _package.InputStream;
                code = _in.HasRemaining() ? _in.Read_int() : default;
            }
            
            public int GetMessageId() {return NetMessageId.hero_upSkillResult;}
            
            public override string ToString()
            {
                return "Hero.upSkillResult"+ ", code="+ code;
            }
        }
        public struct UpFateTrajectoryResultData : IReceiveMessage {
        	private int? _code;
        	public int code {get{return _code == null ? -1 : (int)_code;}private set{_code = value;}}
	        public HeroPOD heroPOD;
            public bool IsFail => _code != null && _code != 0;
            public bool IsSuccess =>_code != null && _code == 0;
            public bool IsCanceled => _code == null;
            public void FromPackage(ReceivePackage _package)
            {
                SInputStream _in = _package.InputStream;
                code = _in.HasRemaining() ? _in.Read_int() : default;
                heroPOD = _in.HasRemaining() ? _in.Read_pod<HeroPOD>(HeroPOD.DynamicFactory) : default;
            }
            
            public int GetMessageId() {return NetMessageId.hero_upFateTrajectoryResult;}
            
            public override string ToString()
            {
                return "Hero.upFateTrajectoryResult"+ ", code="+ code+ ", heroPOD="+ heroPOD;
            }
        }
        public struct WearEquipResultData : IReceiveMessage {
        	private int? _code;
        	public int code {get{return _code == null ? -1 : (int)_code;}private set{_code = value;}}
	        public HeroPOD heroPOD;
            public bool IsFail => _code != null && _code != 0;
            public bool IsSuccess =>_code != null && _code == 0;
            public bool IsCanceled => _code == null;
            public void FromPackage(ReceivePackage _package)
            {
                SInputStream _in = _package.InputStream;
                code = _in.HasRemaining() ? _in.Read_int() : default;
                heroPOD = _in.HasRemaining() ? _in.Read_pod<HeroPOD>(HeroPOD.DynamicFactory) : default;
            }
            
            public int GetMessageId() {return NetMessageId.hero_wearEquipResult;}
            
            public override string ToString()
            {
                return "Hero.wearEquipResult"+ ", code="+ code+ ", heroPOD="+ heroPOD;
            }
        }
        public struct WearPetResultData : IReceiveMessage {
        	private int? _code;
        	public int code {get{return _code == null ? -1 : (int)_code;}private set{_code = value;}}
	        public HeroPOD heroPOD;
            public bool IsFail => _code != null && _code != 0;
            public bool IsSuccess =>_code != null && _code == 0;
            public bool IsCanceled => _code == null;
            public void FromPackage(ReceivePackage _package)
            {
                SInputStream _in = _package.InputStream;
                code = _in.HasRemaining() ? _in.Read_int() : default;
                heroPOD = _in.HasRemaining() ? _in.Read_pod<HeroPOD>(HeroPOD.DynamicFactory) : default;
            }
            
            public int GetMessageId() {return NetMessageId.hero_wearPetResult;}
            
            public override string ToString()
            {
                return "Hero.wearPetResult"+ ", code="+ code+ ", heroPOD="+ heroPOD;
            }
        }
        public struct ClearEquipResultData : IReceiveMessage {
        	private int? _code;
        	public int code {get{return _code == null ? -1 : (int)_code;}private set{_code = value;}}
	        public HeroPOD heroPOD;
            public bool IsFail => _code != null && _code != 0;
            public bool IsSuccess =>_code != null && _code == 0;
            public bool IsCanceled => _code == null;
            public void FromPackage(ReceivePackage _package)
            {
                SInputStream _in = _package.InputStream;
                code = _in.HasRemaining() ? _in.Read_int() : default;
                heroPOD = _in.HasRemaining() ? _in.Read_pod<HeroPOD>(HeroPOD.DynamicFactory) : default;
            }
            
            public int GetMessageId() {return NetMessageId.hero_clearEquipResult;}
            
            public override string ToString()
            {
                return "Hero.clearEquipResult"+ ", code="+ code+ ", heroPOD="+ heroPOD;
            }
        }
        public struct NotifyHeroActiveData : IReceiveMessage {
	        public HeroPOD heroPOD;
            public void FromPackage(ReceivePackage _package)
            {
                SInputStream _in = _package.InputStream;
                heroPOD = _in.HasRemaining() ? _in.Read_pod<HeroPOD>(HeroPOD.DynamicFactory) : default;
            }
            
            public int GetMessageId() {return NetMessageId.hero_notifyHeroActive;}
            
            public override string ToString()
            {
                return "Hero.notifyHeroActive"+ ", heroPOD="+ heroPOD;
            }
        }
        public struct NotifyHeroAttrsData : IReceiveMessage {
	        public HeroPOD heroPOD;
            public void FromPackage(ReceivePackage _package)
            {
                SInputStream _in = _package.InputStream;
                heroPOD = _in.HasRemaining() ? _in.Read_pod<HeroPOD>(HeroPOD.DynamicFactory) : default;
            }
            
            public int GetMessageId() {return NetMessageId.hero_notifyHeroAttrs;}
            
            public override string ToString()
            {
                return "Hero.notifyHeroAttrs"+ ", heroPOD="+ heroPOD;
            }
        }
    }
#endregion
}